package com.pz.gulimall.product.rabbitmq;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class DirectListener {
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "direct.productQue"),     //指定队列
            exchange = @Exchange(name = "product.exchange"), //指定交换机
            key = {"red","blue"}    //指定 key
    ))
    public void listenDirectQue1(Map<String,Object> msg){
        System.out.println("消费者接收到direct.que1的消息：["+msg+"]");
    }

}
